#!usr/bin/env python  
# -*- coding:utf-8 -*-
""" 
@author:robot
@file: solution.py 
@version:
@time: 2024/01/22 
"""
# 注意输入，自己修改成示例样式
input_str = input().split(' ')
target = input_str[0]
size = int(input_str[1])
source = input_str[2:]
flag = True

for _ in range(size):
    if len(source[_]) >= len(target) and source[_][: len(target)] == target:
        print(source[_])
        flag = False

if flag:
    print(-1)
